Skip to content

Upgrade pxapi pypi python dependencies#2143

Closed
ddelnano wants to merge 13 commits intopixie-io:mainfrom
ddelnano:ddelnano/upgrade-pxapi-pypi-deps
Closed

Upgrade pxapi pypi python dependencies#2143
ddelnano wants to merge 13 commits intopixie-io:mainfrom
ddelnano:ddelnano/upgrade-pxapi-pypi-deps

Conversation

@ddelnano
Copy link
Copy Markdown
Member

@ddelnano ddelnano commented Mar 5, 2025

Summary: Upgrade pxapi pypi python dependencies

The pxapi's dependencies haven't been updated in a long time. This PR upgrades the dependencies and the python version constraint to support 3.9 through 3.13.

One of the more complex parts of this change was replacing gogo-python with a bazel supplied equivalent. gogo-python is no longer updated and didn't support protobuf v3. In order to use the gogo repository supplied via rules_go and our internal version (gogo_grpc_proto), the following changes were necessary:

  1. Remove the protobuf compiler patch that renames github/com/gogo to github.com/gogo
  2. Update the rules_go and internal gogo bazel repository to place its files in a similarly named directory (github/com/gogo)
  3. Update all bazel target names and protobuf import statements to use github/com/gogo/... instead of github.com/gogo/...

This is due to the fact that Python does not support periods in module names. rules_go and our internal gogo repository (gogo_grpc_proto) used a directory structure and a protobuf compiler patch that resulting in non functional python code (a module named github.com is created). This change renames the rules_go and internal gogo repository to use github/com/gogo/... instead of the previous github.com/gogo naming.

One slight change I considered was removing the use of the rules_go gogo repository in our targets. This would hopefully avoid the need to patch rules_go with the same github.com -> github/com change. I'm not sure if any third party code relies on gogo that would complicate this simplification. I wanted to get feedback on this PR's direction before moving forward with that.

Relevant Issues: #2140

Type of change: /kind cleanup

Test Plan: Existing unit tests and the following:

  • pip install works for python in 3.9 docker container
  • Run src/api/python/examples with python 3.9 and 3.13
Python 3.9 and 3.13 test
# Build the wheel
$ bazel build src/api/python:pxapi
[ ... ]
Target //src/api/python:pxapi up-to-date:
  bazel-bin/src/api/python/pxapi-0.8.1-py3-none-any.whl

# Run the example with python 3.13
$ docker run --entrypoint bash -it -v $(pwd):/src -w /src python:3.13
$ pip install bazel-bin/src/api/python/pxapi-0.8.1-py3-none-any.whl
root@d5a1f69d4e87:/src# PX_API_KEY=<api key> python src/api/python/examples/list_clusters.py
eb94bd7e-0a8a-45c0-b22e-81d62bd99755

# Run the example with python 3.9
$ docker run --entrypoint bash -it -v $(pwd):/src -w /src python:3.9
$ pip install bazel-bin/src/api/python/pxapi-0.8.1-py3-none-any.whl
root@08ed22fe680e:/src# PX_API_KEY=<api key> python src/api/python/examples/list_clusters.py
eb94bd7e-0a8a-45c0-b22e-81d62bd99755

Changelog Message: Upgrade the pxapi python module's third party dependencies and support Python 3.11 through 3.13

Signed-off-by: Dom Del Nano <ddelnano@gmail.com>
Signed-off-by: Dom Del Nano <ddelnano@gmail.com>
…to fully address

Signed-off-by: Dom Del Nano <ddelnano@gmail.com>
Signed-off-by: Dom Del Nano <ddelnano@gmail.com>
Signed-off-by: Dom Del Nano <ddelnano@gmail.com>
@ddelnano ddelnano force-pushed the ddelnano/upgrade-pxapi-pypi-deps branch from 2316936 to c26ed85 Compare April 15, 2025 03:12
Signed-off-by: Dom Del Nano <ddelnano@gmail.com>
Signed-off-by: Dom Del Nano <ddelnano@gmail.com>
@ddelnano ddelnano force-pushed the ddelnano/upgrade-pxapi-pypi-deps branch from 9aab4da to b7f3782 Compare April 15, 2025 04:40
@ddelnano ddelnano marked this pull request as ready for review April 15, 2025 14:49
@ddelnano ddelnano requested review from a team as code owners April 15, 2025 14:49
Signed-off-by: Dom Del Nano <ddelnano@gmail.com>
Signed-off-by: Dom Del Nano <ddelnano@gmail.com>
Signed-off-by: Dom Del Nano <ddelnano@gmail.com>
@ddelnano ddelnano requested a review from a team as a code owner April 23, 2025 15:18
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It amuses me that GitHub added me to this PR just because of one generated file

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for the noise! Should have moved this to a draft. I believe this proto file change is unexpected but I haven't figured out the cause yet.

@ddelnano ddelnano marked this pull request as draft April 23, 2025 17:10
Signed-off-by: Dom Del Nano <ddelnano@gmail.com>
Signed-off-by: Dom Del Nano <ddelnano@gmail.com>
Signed-off-by: Dom Del Nano <ddelnano@gmail.com>
@ddelnano ddelnano force-pushed the ddelnano/upgrade-pxapi-pypi-deps branch from 5c7876b to ac8e593 Compare April 23, 2025 20:01
@ddelnano
Copy link
Copy Markdown
Member Author

I'll be creating a new PR instead of updating this one.

@ddelnano ddelnano closed this Apr 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants